package com.qianyu.project.mapper.provider.smj;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.jdbc.SQL;
import org.springframework.util.ObjectUtils;

import java.util.Map;

public class smjLaberSalaryProvider {
    //查询工资列表
    public  String listlabersalary(IPage<Map<String, Object>> page, Map<String, String> params){
        return new SQL(){
            {
                SELECT("p.*,pi.project_name");
                FROM("project_salary p");
                LEFT_OUTER_JOIN("project_info pi on p.p_id=pi.id");
                if (!ObjectUtils.isEmpty(params.get("id"))){
                    WHERE("p.id = '"+params.get("id")+"'");
                }
                if (!ObjectUtils.isEmpty(params.get("projectId"))){
                    WHERE("p.p_id = '"+params.get("projectId")+"'");
                }
                if (!ObjectUtils.isEmpty(params.get("year"))){
                    WHERE("p.year = '"+params.get("year")+"'");
                }
                if (!ObjectUtils.isEmpty(params.get("menth"))){
                    WHERE("p.menth = '"+params.get("menth")+"'");
                }
                if (!ObjectUtils.isEmpty(params.get("approve_status"))){
                    WHERE("p.approve_status = '"+params.get("approve_status")+"'");
                }
                if (!ObjectUtils.isEmpty(params.get("handler_id"))){
                    WHERE("p.handler_id = '"+params.get("handler_id")+"'");
                }
            }
        }.toString();
    }
}
